package com.oamicnet.servicetwo.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class CallController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/call")
    public String callProvider() {
        // 远程调用目标服务的接口
        String result = restTemplate.getForObject("http://service-one/system/hello?name=World", String.class);
        System.out.println("result: " + result);
        return result;
    }
}
